package com.study.demo.factorybean;

import java.util.Date;

import org.springframework.beans.factory.FactoryBean;

public class SimpleFactoryBean implements FactoryBean {

	private boolean flag;  
	
	@Override
	public Object getObject() throws Exception {
		if(flag){
			return new Date();
		}
		
		return new String("false");
	}

	@Override
	public Class<?> getObjectType() {
		return flag ? Date.class : String.class;
	}

	@Override
	public boolean isSingleton() {
		return false;
	}

	public void setFlag(boolean flag) {
		this.flag = flag;
	}
	
}
